<template>
	<view class="content">
		<button class="size" @tap="getServices">获取分享服务</button>
		<view v-for="site in shares" :key="site.id">{{site.description}}</view>
		<button class="size" @tap="sendWithSystem">使用系统分享</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shares: []
			}
		},
		methods: {
			getServices() {
				let that = this;
				plus.share.getServices(function(s) {
					that.shares = s;
					console.log("获取分享服务列表success： ", that.shares);
				}, function(e) {
					console.log("获取分享服务列表失败： " + JSON.stringify(e));
				});

			},
			sendWithSystem() {
				//系统自带的分享菜单
				plus.share.sendWithSystem({
					type: 'text',
					content: '分享内容',
					href: 'http://www.dcloud.io/'
				}, function() {
					console.log('分享成功');
				}, function(e) {
					console.log('分享失败：' + JSON.stringify(e));
				});

			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.size {
		margin: 30rpx 0;
	}
</style>
